package com.example.demo.identity.httpApi;

import com.example.demo.identity.application.IdentityUserAppService;
import com.example.demo.identity.application.dtos.IdentityUserDto;
import com.example.demo.identity.application.dtos.IdentityUserFilter;
import com.example.demo.identity.domain.IdentityUser;
import com.example.demo.identity.domain.IdentityUserRepository;
import com.example.jbp.application.dtos.PagedResultDto;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@RestController
@RequestMapping("user")
public class IdentityUserController {
    private final IdentityUserAppService userAppService;

    public IdentityUserController(IdentityUserAppService userAppService) {
        this.userAppService = userAppService;
    }

    @GetMapping("list")
    public PagedResultDto<IdentityUserDto> list(IdentityUserFilter filter, Pageable pageable) {
        return this.userAppService.pageList(filter, pageable);
    }

    @GetMapping("{id}")
    public IdentityUserDto get(@PathVariable UUID id) {
        return this.userAppService.get(id);
    }
}